<%@page isELIgnored="false" import="java.net.*" %>
<%@taglib prefix="tiles" uri="struts-tiles" %>
<%@taglib prefix="html" uri="struts-html" %>
<%@taglib prefix="fn" uri="jstl-fn" %>
<%@taglib prefix="mcfn" uri="mcfn" %>
<%@taglib prefix="bean" uri="struts-bean" %>
<%@taglib prefix="c" uri="jstl" %>

<c:set var="ResAsset"></c:set><c:set var="AssetsLength" value="${fn:length(FlowData.assets)}"/><c:set var="AssetsLengthLast" value="${fn:length(FlowData.assets) - 1}"/><c:forEach items="${FlowData.assets}" var="asset" varStatus="assetStatus"><c:set var="ResAsset">${ResAsset} ${asset.nombre}<c:if test="${assetStatus.index lt AssetsLengthLast}">,</c:if></c:set></c:forEach>
<center>
<br/>
<table style="width: 800px;">
<!--<tr>
    <td style="width: 100%; "><h2>Tarea : ${ResAsset}</h2></td>
</tr>
<tr>
	<td style="width: 100%; ">Cuenta: ${UserLogin.actualCountName}</td>
</tr>
<tr>
	<td style="width: 100%; ">Nombre de Campa&ntilde;a: ${FlowData.campania.nombre}</td>
</tr>-->
<tr>
	<td style="width: 100%; ">&nbsp;<font color="red">${FlowData.error}</font></td>
</tr>

<tr>
        
    <td>
        <table class="tabForms">
            
            <tr class="alt">
                <td align="left">
                    <b><bean:message key="com.mastercard.assets.web.errors.modules.generarcampana.labels.Nombre"/></b> &nbsp;&nbsp;&nbsp;
                    ${FlowData.campania.nombre}
                </td>                
            </tr>
            
            <tr>
                <td align="left">
                    <b><bean:message key="com.mastercard.assets.web.errors.modules.generarcampana.labels.Tipo"/></b> &nbsp;&nbsp;&nbsp;
                    ${FlowData.campania.tblTipoCampania.nombre}
                </td>                
            </tr>
            
            <tr class="alt">
                <td align="left">
                    <b><bean:message key="com.mastercard.assets.web.errors.modules.generarcampana.labels.TipoProducto"/></b> &nbsp;&nbsp;&nbsp;
<c:forEach items="${FlowData.campania.tblTipoProductos}" var="tiprodto">
                                                                    ${tiprodto.nombre}&nbsp;&nbsp;
</c:forEach>                    
                </td>                
            </tr>
            
            <tr>
                <td align="left">
                    <b><bean:message key="com.mastercard.assets.web.errors.modules.generarcampana.labels.Producto"/></b> &nbsp;&nbsp;&nbsp;
<c:forEach items="${FlowData.campania.tblProductos}" var="prod" varStatus="prodStatus" >		
                                                                   ${prod.nombre}&nbsp;&nbsp;
</c:forEach>                    
                </td>                
            </tr>
            
            <tr class="alt">
                <td align="left">
                    <b><bean:message key="com.mastercard.assets.web.errors.modules.generarcampana.labels.FechaInicioCamp"/></b> &nbsp;&nbsp;&nbsp;
                    ${mcfn:formatTimestamp(FlowData.campania.fechaIni,'dd/MM/yyyy') }
                </td>
            </tr>
            
            <tr>
                <td align="left">
                    <b><bean:message key="com.mastercard.assets.web.errors.modules.generarcampana.labels.FechaFinalCamp"/></b> &nbsp;&nbsp;&nbsp;
                    ${mcfn:formatTimestamp(FlowData.campania.fechaFin,'dd/MM/yyyy') }
                </td>
            </tr>
            
            <tr class="alt">
                <td align="left">
                    <b><bean:message key="com.mastercard.assets.web.errors.modules.generarcampana.labels.Multiple"/></b>&nbsp;&nbsp;&nbsp;
                    <c:if test="${FlowData.campania.multiplePartner eq 2}">No</c:if>
                    <c:if test="${FlowData.campania.multiplePartner eq 1}">Si</c:if>
                </td>
            </tr>
            
            <tr>
                <td align="left">
                    <b><bean:message key="com.mastercard.assets.web.errors.modules.generarcampana.labels.Descripcion"/></b> &nbsp;&nbsp;&nbsp;
                    ${FlowData.campania.texto}
                </td>
            </tr>
            
            <tr class="alt">
                <td align="left">
                    <table width="100%" >                       


<c:set value="${FlowData.assetS}" var="Assets"/>
<c:set value="${fn:length(Assets)}" var="CantidadAssets"/>
							<tr>
								<td align="left">
                                                                    <b><bean:message key="com.mastercard.assets.web.errors.modules.generarcampana.labels.CantidadAssets"/></b> &nbsp;&nbsp;&nbsp;
                                                                    ${CantidadAssets }
                                                                </td>
                                                                <td>&nbsp;</td>
							</tr>
<c:forEach items="${Assets}" var="asset" varStatus="assetStatus">
							<tr>
                                                            <td colspan="2">
                                                                <table width="100%" border="0" >
                                                                    <tr>
                                                                        <td align="left" width="50%">
                                                                            <b>
                                                                            ${assetStatus.index + 1}.- ${asset.nombre} (${asset.quantityOfPackage } paquetes)<br/>
                                                                            </b>
                                                                        </td>
                                                                        <td align="left" width="25%"><b>Tipo</b></td>
                                                                        <td align="left" width="25%"><b>Precio</b></td>                                                                        
                                                                    </tr>
                                                                    
                                                                    <c:forEach items="${FlowData.campania.tblPaquetes}" var="pack" varStatus="packStatus">
                                                                            <c:if test="${pack.tblAsset.cveAsset eq asset.cveAsset }">
                                                                        <tr>
                                                                            <td>&nbsp;</td>
                                                                            <td align="left">
                                                                                <c:if test="${pack.habitacion eq 2 }">Doble</c:if>
                                                                                <c:if test="${pack.habitacion eq 1 }">sencilla</c:if>
                                                                            </td>
                                                                            <td align="left">
                                                                                <c:if test="${pack.habitacion eq 2 and pack.fondeado eq 1 }">$ ${pack.tblAsset.costoDobLoc }</c:if>
                                                                                <c:if test="${pack.habitacion eq 2 and pack.fondeado eq 2 }">$ ${pack.tblAsset.costoDobReg}</c:if>
                                                                                <c:if test="${pack.habitacion eq 1 and pack.fondeado eq 1 }">$ ${pack.tblAsset.costoSenLoc}</c:if>
                                                                                <c:if test="${pack.habitacion eq 1 and pack.fondeado eq 2 }">$ ${pack.tblAsset.costoSenReg}</c:if>
                                                                            </td>
                                                                        </tr>
                                                                            </c:if>
                                                                        </c:forEach> 
                                                                    
                                                                </table>
                                                                
                                                            </td>
								
							</tr>
</c:forEach>
                        
                    </table>
                </td>
            </tr>
            
            <tr class="alt">
                <td align="left">
                    <b><bean:message key="com.mastercard.assets.web.errors.modules.generarcampana.labels.Estrategica"/></b> &nbsp;&nbsp;&nbsp;
                    <c:if test="${FlowData.campania.estrategica eq 0}">No</c:if>
                    <c:if test="${FlowData.campania.estrategica eq 1}">Si</c:if>
                </td>
            </tr>
            
            <c:if test="${FlowData.campania.estrategica eq 1}">
                <tr>
                    <td align="left">
                        <span style="font-weight: bolder; text-align: left; ">Comentarios</span> &nbsp;&nbsp;&nbsp;
                        ${FlowData.campania.comentarios}
                    </td>
                </tr>
            </c:if>
                
                <tr class="alt">
                    <td colspan="2">
                        
<c:set var="AllProductsLength" value="${fn:length(FlowData.campania.tblTipoProductos)}" />
<c:set var="TableAssetColPercentage" value="${25}" />
<c:set var="TableProductColPercentage" value="${( 100 - TableAssetColPercentage ) / AllProductsLength }" />
<c:set var="DucA" value="${FlowData.meses}" />

<c:choose>
    <c:when test="${FlowData.campania.tblTipoCampania.cveTipoCampania eq 2 }">
<!--        <tr>
    <td colspan="4">-->
        
        <table width="100%" border="0">
            <tr class="alt" >
		<td width="${TableAssetColPercentage }%" style="background: lightgray; color: black; font-weight: bolder; text-align: left; ">
			Target Assumptions                        
		</td>
<c:forEach items="${FlowData.campania.tblProductos}" var="cpaw" varStatus="cpawStatus" >
		<td style="background: lightgray; color: black; font-weight: bolder; text-align: left; ">
			${cpaw.nombre}
		</td>
</c:forEach>
            </tr>            
            
                <c:forEach items="${FlowData.meses}" var="durac" varStatus="duracStatus" >
                                     
                    <tr>
                        <td style="font-weight: bolder; text-align: left; ">
                           Tarjetas nuevas mes ${duracStatus.count} 
                        </td>

                    <c:forEach items="${FlowData.tblCampaniaProductoAdq}" var="Adq" varStatus="AdqStatus" >
                        
                        <c:if test="${Adq.mes eq durac}">
                                <td style="text-align: left; ">
                                    ${Adq.tarjetas}
                                </td>                            
                        </c:if>
                                
                    </c:forEach>
                        
                    </tr>
                </c:forEach>

            
            <tr>
			<td width="${TableAssetColPercentage }%" style="font-weight: bolder; text-align: left; ">
				Tarjetas Totales por Producto
			</td>
<c:forEach items="${FlowData.ttp}" var="ttp" varStatus="ttpStatus" >    
    
			<td style="text-align: left; ">
				${ttp}
			</td>
                        
</c:forEach>
            </tr>
            
            <tr>
		<td style="font-weight: bolder; text-align: left; ">
			Tarjetas para Campa&ntilde;a
		</td>
		<td style="text-align: left; ">
                        ${FlowData.total}
		</td>
	</tr>
            
        </table>
        
<!--    </td>
</tr>-->
    </c:when>
                        <c:when test="${FlowData.campania.tblTipoCampania.cveTipoCampania eq 7 }">
                            <table width="100%" border="0">
                                <tr>
                                    <td>
                                        &nbsp;&nbsp;&nbsp;
                                    </td>
                                </tr>
                            </table>                        
                        </c:when>            
    <c:otherwise>
<!--        <tr>
                                                                     <td colspan="4">-->
<table width="100%" border="0">
	<tr class="alt">
		<td width="${TableAssetColPercentage }%" style="color: black; font-weight: bolder; text-align: left; ">
			Target Assumptions
		</td>

<c:forEach items="${FlowData.campania.tblProductos}" var="cpw" varStatus="cpwStatus" >
		<td style="color: black; font-weight: bolder; text-align: left; ">
                    ${cpw.nombre}
		</td>
</c:forEach>

        </tr>
        
        <tr>
		<td style="font-weight: bolder; text-align: left; ">
			Average ticket
		</td>

<c:forEach items="${FlowData.campania.tblCampaniaProductoUsuarios}" var="cpu" varStatus="cpuStatus" >
		<td style="text-align: left; ">
                    ${cpu.averaGetTicket}&nbsp;(dolares)
		</td>
</c:forEach>

	</tr>
        <tr>
		<td style="font-weight: bolder; text-align: left; ">
			Duraci&oacute;n de la campa&ntilde;a
		</td>
		<td style="text-align: left; ">
                    ${FlowData.campania.meses} (meses)
		</td>
	</tr>
        
        <!-- Pinta rows -->
<c:forEach items="${FlowData.meses}" var="durac" varStatus="duracStatus" >
                    <tr>
                        <td style="font-weight: bolder; text-align: left; ">
                           <c:if test="${FlowData.campania.tblTipoCampania.cveTipoCampania eq 8}">Activation rate mes ${duracStatus.count}</c:if>
                           <c:if test="${FlowData.campania.tblTipoCampania.cveTipoCampania ne 8}">Response rate mes ${duracStatus.count}</c:if>                             
                        </td>

<c:forEach items="${FlowData.tblCampaniaMeses}" var="tcm" varStatus="tcmStatus" >
    <c:if test="${tcm.mes eq duracStatus.count }">
                        <td style="text-align: left; ">
                            ${tcm.responseRate}&nbsp;(porcentaje)
                        </td>        
    </c:if>     
</c:forEach>
                    </tr>
</c:forEach>
        <!-- Pinta rows -->

        <tr>
		<td style="font-weight: bolder; text-align: left; ">
			Incremental Transaction
		</td>

<c:forEach items="${FlowData.tblCampaniaProductoUsr}" var="cpu" varStatus="cpuStatus" >
		<td style="text-align: left; ">
                    ${cpu.incrementalTransaction}&nbsp; (numero)
		</td>
</c:forEach>

	</tr>
        
        <!-- Pinta rows -->
<c:forEach items="${FlowData.meses}" var="durac" varStatus="duracStatus" >
                    <tr>
                        <td style="font-weight: bolder; text-align: left; ">
                           GDV por mes ${duracStatus.count} 
                        </td>

<c:forEach items="${FlowData.tblCampaniaMeses}" var="tcm" varStatus="tcmStatus" >
    <c:if test="${tcm.mes eq duracStatus.count }">
                        <td style="text-align: left; ">
                            ${tcm.gdvTotalMes}&nbsp;(dolares)
                        </td>        
    </c:if>     
</c:forEach>

                    </tr>
</c:forEach>
        <!-- Pinta rows -->
        
        <tr>
		<td style="font-weight: bolder; text-align: left; ">
			GDV total del producto
		</td>

<c:forEach items="${FlowData.tblCampaniaProductoUsr}" var="cpu" varStatus="cpuStatus" >
		<td style="text-align: left; ">
                    ${cpu.gdvTotalDelProducto}(dolares)
		</td>
</c:forEach>

	</tr>   
        
</table>
<!--								 	</td>
                                                                 </tr>-->
    </c:otherwise>
</c:choose>                                                      

                        
                    </td>
                </tr>
<c:if test="${FlowData.campania.tblTipoCampania.cveTipoCampania ne 7 }">
                <tr>
                    <td>
                        <b>ROI:</b>&nbsp;${FlowData.campania.roi}   &nbsp;&nbsp;&nbsp;&nbsp;<b>Revenue:</b>&nbsp; ${FlowData.campania.revenue}
                    </td>
                </tr>
</c:if>                
                
            
        </table>
        
    </td>
    
</tr>


<tr>
	<td style="width: 100%; ">&nbsp;</td>
</tr>
<tr>
	<td>
		<table style="width: 100%;">
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
<!--			<tr>
				<td valign="top">Comentarios</td>
				<td colspan="2"><textarea style="width: 100%; height: 150px; background-color: #C0C0C0; " name="comentarios" ></textarea></td>
			</tr>-->
			<tr>
				<td colspan="3" align="center"><input type="button" value="Terminar la Tarea" onclick="if( confirm( 'Confirmas de enterado?' ) ) processExit( 'Ok' );" /></td>
			</tr>
		</table>
	</td>
</tr>


</table>
</center>   